#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>

static void *new_thread_start(void *arg)
{
    printf("new  thread start\r\n");
    sleep(2);
    printf("new threasd end\r\n");
    pthread_exit(NULL);
}

int  main(void)
{
    pthread_t tid;
    void  *tret;
    int ret;

    ret = pthread_create(&tid,NULL,new_thread_start,NULL);
    if(ret){
        fprintf(stderr,"pthread_create error: %s\n",strerror(ret));
        exit(-1);
    }
    
    ret = pthread_join(tid,&tret);
    if(ret){
        fprintf(stderr,"pthread_join error: %s\n",strerror(ret));
        exit(-1);
    }
    printf("new pthread stop,code = %ld\n",(long)tret);
    exit(0);
}